package com.itheima.stock.mapper;

import com.itheima.stock.common.domain.Stock4EvrDayDomain;
import com.itheima.stock.common.domain.Stock4MinuteDomain;
import com.itheima.stock.common.domain.StockUpdownDomain;
import com.itheima.stock.pojo.StockRtInfo;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.Date;
import java.util.List;
import java.util.Map;

/**
* @author computer
* @description 针对表【stock_rt_info(个股详情信息表)】的数据库操作Mapper
* @createDate 2022-05-10 12:13:06
* @Entity com.itheima.stock.pojo.StockRtInfo
*/
@Mapper
public interface StockRtInfoMapper {

    int deleteByPrimaryKey(Long id);

    int insert(StockRtInfo record);

    int insertSelective(StockRtInfo record);

    StockRtInfo selectByPrimaryKey(Long id);

    int updateByPrimaryKeySelective(StockRtInfo record);

    int updateByPrimaryKey(StockRtInfo record);

    //根据指定时间点查询股票的数据 并根据涨幅 降序排序 取前10
    List<StockUpdownDomain> getStockInfoByIncrease(@Param("curDate") Date curDate);

    //查询所有股票信息 并按涨幅 降序
    List<StockUpdownDomain> getStockAll();

    //根据日期范围查询对应的涨停、跌停 数据
    List<Map> getStockUpdownCount(@Param("startTime") Date startTime,
                                  @Param("endTime") Date endTime,
                                  @Param("flag") int flag);

    //根据指定时间点查询各个涨幅区间的数量 精确到分钟
    List<Map> getLastDate4Stock(@Param("curTime") Date curTime);


    List<Stock4MinuteDomain> getStockScreenTimeSharing(@Param("stockCode") String stockCode,
                                                       @Param("startTime") Date startTime,
                                                       @Param("endTime") Date endTime);

    List<Stock4EvrDayDomain> getStockScreenDayKLine(@Param("stockCode") String stockCode,
                                                    @Param("startDate") Date startDate,
                                                    @Param("endDate") Date endDate);

    //批量插入股票信息
    int insertBatch(@Param("infos") List list);

}
